//
//  ViewController.m
//  TTSourceDemo
//
//  Created by apple on 2017/4/23.
//  Copyright © 2017年 ttayaa. All rights reserved.
//

#import "ViewController.h"

#import "testview.h"



@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textf;
@property (strong, nonatomic) IBOutlet UIView *view;

@end

@implementation ViewController




-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

      [self TTNVAlphaBar:TTAlphaNaviBarStyle2 BarColor:[UIColor blackColor] bindScrollView:self.tableView];
//    [self TTNVDefaultBarWithImg:[UIImage imageNamed:@"nvbar"]];

//    [self TTNVShowLine:NO];

}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
//    [self TTNVDefaultBarWithColor:[UIColor greenColor]];
//    [self TTNVDefaultBarWithImg:[UIImage imageNamed:@"nvbar"]];

    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
  

    
    
    UIView *hview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, hScreenWidth, 2000)];
    hview.backgroundColor = [UIColor greenColor];
    self.tableView.tableHeaderView = hview;
    
    hview.clickSignalName = @"hview";
    
//    [self openDeallocLog:YES];
    
    UIView *view =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    
    view.backgroundColor = [UIColor redColor];
    
    view.clickSignalName = @"asdasd";
    [self.view addSubview:view];
    
    [self.textf setUIControlEvent:UIControlEventEditingChanged];
    
    

    
    
}


Click_signal(hview)
{
    [self.navigationController WillPushViewController:@"VC3" animated:YES SetupParms:^(UIViewController *vc, NSMutableDictionary *dict) {
        
    } callback:^(id parameter) {
        
    } jumpError:^{
        
    }];
}


Click_signal(textf)
{
    ttLog(@"%@",self.textf.text);
}

Click_signal(swich)
{
    ttLog(@"%@",signal.view);
}
Click_signal(btn)
{
     ttLog(@"%@",signal.view);
}
Click_signal(lb)
{
    [self WillPresentViewController:@"ZCBHomeController" animated:YES frame:hScreenBounds style:TTPresentStyleCustomModal_blackhud SetupParms:nil completion:nil callback:nil jumpError:nil];
}


Click_signal(asdasd)
{
    
    [self WillPresentViewController:@"VC1" animated:YES frame:CGRectMake(hScreenWidth-150, 74, 146, 165) style:TTPresentStyleCustomModal_blackhud SetupParms:^(UIViewController *vc, NSMutableDictionary *dict) {
        
        CGRect rect = CGRectMake(5, 5, 5, 5);
        
        [dict addEntriesFromDictionary:@{
                                         @"test1":@"传参数啦",
                                         @"testint":@"123",
                                         @"testrect":[NSValue valueWithCGRect:rect]
                                         }];
    } completion:^{
        
    } callback:^(id parameter) {
        
    } jumpError:^{
        
        UILabel *lb = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, 350, 40)];
        lb.font = [UIFont systemFontOfSize:13];
        lb.text =[NSString stringWithFormat:@"VC2模块,不在该项目中...."];
        lb.backgroundColor = [UIColor blueColor];
        lb.textColor = [UIColor whiteColor];
        
        lb.layer.cornerRadius = 5;
        lb.layer.masksToBounds = YES;
        
        //        view.backgroundColor = randomColor;
        [[UIApplication sharedApplication].keyWindow addSubview:lb];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [lb removeFromSuperview];
        });
        
    }];
    
//    
//    [self WillPresentViewController:@"VC1" animated:YES frame:CGRectMake(hScreenWidth-150, 74, 146, 165) hudColor:[UIColor redColor] whenDisplay:^(UIView *toView, id<UIViewControllerContextTransitioning> transitionContext) {
//        
//        toView.transform = CGAffineTransformMakeScale(0.2, 0.2);
//        toView.layer.anchorPoint = CGPointMake(0.9, 0);
//        toView.alpha = 0.2;
//        [UIView animateWithDuration:0.2 animations:^{
//            toView.transform = CGAffineTransformMakeScale(1, 1);
//            toView.alpha = 1;
//            
//        } completion:^(BOOL finished) {
//            toView.transform = CGAffineTransformIdentity;
//            
//            [transitionContext completeTransition:YES];
//            
//        }];
//        
//    } whenDismiss:^(UIView *fromView, id<UIViewControllerContextTransitioning> transitionContext) {
//        
//        fromView.transform = CGAffineTransformMakeScale(1, 1);
//        
//        [UIView animateWithDuration:0.2 animations:^{
//            fromView.transform = CGAffineTransformMakeScale(0.5, 0.5);
//            fromView.alpha = 0;
//        } completion:^(BOOL finished) {
//            
//            [transitionContext completeTransition:YES];
//            
//        }];
//        
//    } SetupParms:^(UIViewController *vc, NSMutableDictionary *dict) {
//        
//        [dict addEntriesFromDictionary:@{
//                                         @"test1":@"传参数啦",
//                                         }];
//        
//    } completion:^{
//        
//        
//    } callback:^(id parameter) {
//       
//        
//    }];
    
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
